﻿using System;
using HomeDump.Core.Contracts;

namespace HomeDump.Server.Components.MusicSearch
{
	/// <summary>
	/// Class representing a music file.
	/// </summary>
	public class MusicFile
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="MusicFile"/> class.
		/// </summary>
		public MusicFile(
			string name,
			string artist,
			string album,
			TimeSpan duration,
			string fileName)
		{
			Requires.IsNotNullOrEmpty(name);
			Requires.IsNotNullOrEmpty(artist);
			Requires.IsNotNullOrEmpty(album);
			Requires.IsTrue(duration != TimeSpan.Zero);
			Requires.IsNotNullOrEmpty(fileName);

			Name = name;
			Artist = artist;
			Album = album;
			Duration = duration;
			FileName = fileName;
		}


		/// <summary>
		/// Gets the name.
		/// </summary>
		public string Name { get; private set; }


		/// <summary>
		/// Gets the artist.
		/// </summary>
		public string Artist { get; private set; }


		/// <summary>
		/// Gets the album.
		/// </summary>
		public string Album { get; private set; }


		/// <summary>
		/// Gets the duration.
		/// </summary>
		public TimeSpan Duration { get; private set; }


		/// <summary>
		/// Gets the file name.
		/// </summary>
		public string FileName { get; private set; }
	}
}